<template>
  <el-sub-menu v-if="menu.children && menu.children.length" :index="menu.url">
    <template #title>
      <el-icon><location /></el-icon>
      {{ menu.label }}
    </template>
    <MenuItem v-for="(child, index) in menu.children" :menu="child" :key="index" />
  </el-sub-menu>
  <el-menu-item v-else :index="menu.url">
    <el-icon><location /></el-icon>
    {{ menu.label }}
  </el-menu-item>
</template>

<script setup>
import MenuItem from './MenuItem.vue'
defineProps({
  menu: {
    type: Object,
    default: () => ({})
  }
})
</script>
